<?php

/** @var \Laravel\Lumen\Routing\Router $router */

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It is a breeze. Simply tell Lumen the URIs it should respond to
| and give it the Closure to call when that URI is requested.
|
*/
$api = $router->app;

//选号系统后台管理
//后台管理
$router->group(['prefix' => 'dev-api', 'namespace' => 'XhAdmin', 'middleware' => 'XSSFilter|adminLogin|adminRole|AdminRoust'], function ($api) {
    $api->get('xh/phones/index', 'PhonesController@index');
    $api->put('xh/phones/edit', 'PhonesController@edit');
    $api->put('xh/phones/status', 'PhonesController@status');
    $api->post('xh/phones/add', 'PhonesController@add');
    $api->delete('xh/phones/del/{id}', 'PhonesController@del');

    $api->get('xh/grid/index', 'GridController@index');
    $api->put('xh/grid/edit', 'GridController@edit');
    $api->put('xh/grid/status', 'GridController@status');
    $api->post('xh/grid/add', 'GridController@add');
    $api->delete('xh/grid/del/{id}', 'GridController@del');

    $api->get('xh/swiper/index', 'SwiperController@index');
    $api->put('xh/swiper/edit', 'SwiperController@edit');
    $api->put('xh/swiper/status', 'SwiperController@status');
    $api->post('xh/swiper/add', 'SwiperController@add');
    $api->delete('xh/swiper/del/{id}', 'SwiperController@del');

    $api->get('xh/ad/index', 'AdController@index');
    $api->put('xh/ad/edit', 'AdController@edit');
    $api->put('xh/ad/status', 'AdController@status');
    $api->post('xh/ad/add', 'AdController@add');
    $api->delete('xh/ad/del/{id}', 'AdController@del');

    $api->get('xh/navtab/index', 'NavtabController@index');
    $api->put('xh/navtab/edit', 'NavtabController@edit');
    $api->put('xh/navtab/status', 'NavtabController@status');
    $api->post('xh/navtab/add', 'NavtabController@add');
    $api->delete('xh/navtab/del/{id}', 'NavtabController@del');

    $api->get('xh/kefu/index', 'KefuController@index');
    $api->put('xh/kefu/edit', 'KefuController@edit');
    $api->post('xh/kefu/add', 'KefuController@add');
    $api->delete('xh/kefu/del/{id}', 'KefuController@del');
});
//前台数据
//不用token验证的路由
$router->group(['prefix' => 'api/xh', 'namespace' => 'XhApi', 'middleware' => 'XSSFilter|AdminRoust'], function ($api) {
    $api->post('login', 'LoginController@login');
    $api->post('loginMini', 'LoginController@byMini');
    $api->post('loginApp', 'LoginController@byApp');
    $api->post('logout', 'LoginController@logout');
//    $api->post('register', 'LoginController@register');
//    $api->post('registerSend', 'LoginController@sendregisterYanZhengMa');
    $api->post('loginSend', 'LoginController@sendloginYanZhengMa');
    $api->post('loginSms', 'LoginController@loginSms');
//    $api->post('registerSms', 'LoginController@registerSms');
//这些都可以不用登陆查看
    $api->post('pay/notify', 'PayController@notify');
    $api->post('pay/notifyRefunds', 'PayController@notifyRefunds');

    $api->get('index', 'IndexController@index');
    $api->get('goods/index', 'GoodsController@index');
    $api->get('goods/list', 'GoodsController@list');
    $api->get('goods/detail', 'GoodsController@detail');
    $api->get('goods/buy', 'GoodsController@buy');
    $api->get('goods/search', 'GoodsController@search');
    $api->get('goods/searchOptions', 'GoodsController@searchOptions');

    $api->get('kefu/index', 'KefuController@index');
    $api->get('kefu/exclusive', 'KefuController@exclusive');
    $api->get('kefu/question', 'KefuController@question');
    $api->get('kefu/answer', 'KefuController@answer');
    $api->post('kefu/isUse', 'KefuController@isUse');
    $api->get('regulations/index', 'RegulationsController@index');
    $api->get('address/regions', 'AddressController@regions');

});
$router->group(['prefix' => 'api/xh', 'middleware' => 'AdminRoust'], function ($api) {
    // $api->get('sllogview', 'LogViewerController@index');            //日志管理
    $api->post('captchaImage', 'VerificateController@captchaImageNew'); //图形验证码
});
$router->group(['prefix' => 'api/xh','namespace' => 'Admin', 'middleware' => 'AdminRoust'], function ($api) {
    $api->post('login', 'LoginController@login');
});
//要登陆的项
$router->group(['prefix' => 'api/xh', 'namespace' => 'XhApi', 'middleware' => 'XSSFilter|XhLogin|AdminRoust'], function ($api) {
    $api->get('my/index', 'MyController@index');
    $api->get('my/setting', 'MyController@setting');

    $api->post('pay/mini', 'PayController@mini');

    $api->post('orders/buy', 'OrdersController@buy');
    $api->post('orders/editAddress', 'OrdersController@editAddress');
    $api->get('orders/index', 'OrdersController@index');
    $api->get('orders/detail', 'OrdersController@detail');
    $api->get('orders/logistics', 'OrdersController@logistics');
    $api->get('address/index', 'AddressController@index');
    $api->post('address/add', 'AddressController@add');
    $api->post('address/edit', 'AddressController@edit');
});
